#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2023/9/4 22:52
# @Author  : BadMan
# @FileName: 01_爬取淘宝信息.py

import requests
import re

# 获取页面源代码
def getHTMLText(url):
    pass

# 对页面进行解析
def parsePage(list_info,html):
    pass

# 将商品信息输出
def printList():
    pass

# url=https://h5api.m.taobao.com/h5/mtop.relationrecommend.wirelessrecommend.recommend/2.0/

if __name__ == '__main__':
    # 定义关键词
    key_word = '书包'
    # 设置爬取的页数
    depth = 2
    params = {
       'jsv':'2.6.2',
       'appKey':'12574478',
       't':'1693842900066',
       'sign':'a904f455adb15a830c4f733f47348178',
       'api':'mtop.relationrecommend.WirelessRecommend.recommend',
       'v':'2.0',
       'type':'jsonp',
       'dataType':'jsonp',
       'callback':'mtopjsonp1',
       'data':'{"appId": "34385","params": "{\"device\":\"HMA-AL00\",\"isBeta\":\"false\",\"grayHair\":\"false\",\"from\":\"nt_history\",\"brand\":\"HUAWEI\",\"info\":\"wifi\",\"index\":\"4\",\"rainbow\":\"\",\"schemaType\":\"auction\",\"elderHome\":\"false\",\"isEnterSrpSearch\":\"true\",\"newSearch\":\"false\",\"network\":\"wifi\",\"subtype\":\"\",\"hasPreposeFilter\":\"false\",\"prepositionVersion\":\"v2\",\"client_os\":\"Android\",\"gpsEnabled\":\"false\",\"searchDoorFrom\":\"srp\",\"debug_rerankNewOpenCard\":\"false\",\"homePageVersion\":\"v7\",\"searchElderHomeOpen\":\"false\",\"search_action\":\"initiative\",\"sugg\":\"_4_1\",\"sversion\":\"13.6\",\"style\":\"list\",\"ttid\":\"600000@taobao_pc_10.7.0\",\"needTabs\":\"true\",\"areaCode\":\"CN\",\"vm\":\"nw\",\"countryNum\":\"156\",\"m\":\"pc\",\"page\":1,\"n\":48,\"q\":\"%E4%B9%A6%E5%8C%85\",\"tab\":\"all\",\"pageSize\":48,\"totalPage\":100,\"totalResults\":4800,\"sourceS\":\"0\",\"sort\":\"_coefp\",\"bcoffset\":\"\",\"ntoffset\":\"\",\"filterTag\":\"\",\"service\":\"\",\"prop\":\"\",\"loc\":\"\",\"start_price\":null,\"end_price\":null,\"startPrice\":null,\"endPrice\":null,\"itemIds\":null,\"p4pIds\":null}"}'
    }

    start_utl = "https://h5api.m.taobao.com/h5/mtop.relationrecommend.wirelessrecommend.recommend/2.0/"
